import request from '../utils/request'

export function register(params) {
    return request.post('/front/user/register', params);
}

export function login(params) {
    return request.post('/front/user/login', params);
}

export function submitFeedBack(params) {
    return request.post('/front/user/feedback', params);
}

export function comment(params) {
    return request.post('/front/user/comment',params);
}

export function deleteComment(id) {
    return request.delete(`/front/user/comment/${id}`);
}

export function updateComment(id,content) {
    return request.putForm(`/front/user/comment/${id}`,content);
}

export function getUserinfo() {
    return request.get('/front/user');
}

export function updateUserInfo(userInfo) {
    return request.put('/front/user',userInfo);
}

export function listComments(params) {
    return request.get('/front/user/comments', { params });
}


import axios from 'axios';

const BASE_URL = process.env.VUE_APP_API_BASE_URL; // 假设这是你的后端API基础URL

export const getBookshelf = async (userId) => {
    const response = await axios.get(`${BASE_URL}/bookshelf/${userId}`);
    return response.data;
};

export const addBookToShelf = async (userId, bookId) => {
    const response = await axios.post(`${BASE_URL}/bookshelf/${userId}`, { bookId });
    return response.data;
};

export const removeBookFromShelf = async (userId, bookId) => {
    const response = await axios.delete(`${BASE_URL}/bookshelf/${userId}/${bookId}`);
    return response.data;
};
